home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
CU Amiga Super CD-ROM 18
/
CU Amiga Magazine's Super CD-ROM 18 (1997)(EMAP Images)(GB)[!][issue 1998-01].iso
/
CUCD
/
Magazine
/
WiredWorld
/
THOR_2.5_upgrade
/
rexx
/
UUDecodeConf.thor
< prev
next >
Wrap
Text File
|
1997-09-15
|
3KB
|
150 lines
/*
* $VER: UUDecodeConf.thor 4.2 (1.9.95)
*
* Decodes all uuencoded files in a conference.
*
* Version 4.2 changed by Troels to use Rexx/UUDecode.thor for
* decoding, instead of being hardcoded to use uuOut.
*
*/
/* trace results */
options results
MDB_DELETED = 5 /* Message is deleted. */
p = ' ' || address() || ' ' || show('P',,)
thorport = pos(' THOR.',p)
if thorport > 0 then thorport = word(substr(p,thorport+1),1)
else
do
say 'No THOR port found!'
exit 10
end
if ~show('p', 'BBSREAD') then do
address command
"run >nil: `GetEnv THOR/THORPath`bin/LoadBBSRead"
"WaitForPort BBSREAD"
end
address BBSREAD
GETGLOBALDATA GLOBALDATA
if(rc ~= 0) then
do
address(thorport)
REQUESTNOTIFY TEXT '"GETGLOBALDATA: ' || BBSREAD.LASTERROR || '"' BT '"_Ok"'
exit
end
if GLOBALDATA.TMPDIR == '' then tmpfile = 'T:tfil1'
else
do
if ~(right(GLOBALDATA.TMPDIR,1) = ':' | right(GLOBALDATA.TMPDIR,1) = '/') then tmpfile = GLOBALDATA.TMPDIR || '/tfil1'
else tmpfile = GLOBALDATA.TMPDIR || 'tfil1'
end
if exists(tmpfile) then address command 'delete >nil:' tmpfile
address(thorport)
CURRENTSYSTEM stem CURRENT
if(rc ~= 0) then
do
REQUESTNOTIFY TEXT '"CURRENTSYSTEM: ' || THOR.LASTERROR || '"' BT '"_Ok"'
exit
end
if CURRENT.CONFNAME == "" then
do
REQUESTNOTIFY TEXT '"No Active Conference"' BT '"_Ok"'
exit
end
GETMESSAGEARRAY CONF '"'CURRENT.CONFNAME'"' STEM ARRAY
if(rc ~= 0) then
do
REQUESTNOTIFY TEXT '"GETMESSAGEARRAY: ' || THOR.LASTERROR || '"' BT '"_Ok"'
exit
end
if ARRAY.COUNT == 0 then
if(rc ~= 0) then
do
REQUESTNOTIFY TEXT '"No messages to process"' BT '"_Ok"'
exit
end
mcnt = 0
drop MSGLIST.
address BBSREAD
do n = 1 to ARRAY.COUNT
READBRMESSAGE '"'||CURRENT.BBSNAME||'"' '"'||CURRENT.CONFNAME||'"' ARRAY.n headstem MSGHEAD datastem MSGDATA
if(rc ~= 0) then
do
address(thorport)
REQUESTNOTIFY TEXT '"READBRMESSAGE: ' || BBSREAD.LASTERROR || '"' BT '"_Ok"'
exit
end
if ~(bittst(MSGDATA.FLAGS, MDB_DELETED)) then
do
mcnt = mcnt + 1
MSGLIST.mcnt = ARRAY.n
MSGLIST.mcnt.SUBJECT = MSGHEAD.SUBJECT
end
end
address(thorport)
do m = 1 to mcnt
writemsg = 0
do n = 1 to mcnt
if MSGLIST.n > 0 then
do
if writemsg > 0 then
do
if MSGLIST.n.SUBJECT < MSGLIST.writemsg.SUBJECT then writemsg = n
end
else writemsg = n
end
end
if writemsg > 0 then
do
SAVEMESSAGE '"'||CURRENT.BBSNAME||'"' '"'||CURRENT.CONFNAME||'"' MSGLIST.writemsg NOHEADER NOANSI FILE tmpfile
if(rc ~= 0) then
do
REQUESTNOTIFY TEXT '"Not able to save current message."' BT '"_Ok"'
exit
end
MSGLIST.writemsg = 0
end
end
address command 'rx `GetEnv THOR/THORPath`Rexx/UUDecode.thor ' || tmpfile
address(thorport)
if(rc ~= 0) then
do
REQUESTNOTIFY TEXT '"'Error in uudecoding!'"' BT '"_Ok"'
end
else
do
REQUESTNOTIFY TEXT '"'Done!'"' BT '"_Ok"'
end
address command 'delete >nil:' tmpfile
exit